package com.main.by.service.impl;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.main.by.dao.NewsInfoDao;
import com.main.by.entity.vo.NewsInfoVO;
import com.main.by.service.NewsInfoService;

@Service
public class NewsInfoServiceImpl implements NewsInfoService {
	
	private static Logger logger = Logger.getLogger(NewsInfoServiceImpl.class);
	
	@Autowired
	private NewsInfoDao newsInfoDao;

	@Override
	public boolean addNewSInfo(NewsInfoVO news, HttpServletRequest request,HttpServletResponse response) throws Exception {
		boolean successful = newsInfoDao.insterNewsInfo(news);
		return successful;
	}

	@Override
	public List<NewsInfoVO> findAllNews(HttpServletRequest request) throws Exception {
		logger.info("查询数据库");
		return  newsInfoDao.findNews();
	}

	@Override
	public NewsInfoVO findNewsById(int newsId) throws Exception {
		logger.info("查询新闻数据库");
		return  newsInfoDao.findNewsById(newsId);
	}

	@Override
	public boolean deleteNewsById(int newsId) throws Exception {
		logger.info("查询管理员数据库");
		return  newsInfoDao.deleteNewsById(newsId);
	}
	
	

}
